Skip to content

Fix IMAP4WithTimeout compatibility with Python 3.14#641

Merged
mjs merged 1 commit into
mjs:masterfrom
736-c41-2c1-e464fc974:bugfix/3.14-compatibility-IMAP4.file-read-only
Jun 28, 2026
Merged

Fix IMAP4WithTimeout compatibility with Python 3.14#641
mjs merged 1 commit into
mjs:masterfrom
736-c41-2c1-e464fc974:bugfix/3.14-compatibility-IMAP4.file-read-only

Conversation

@736-c41-2c1-e464fc974

Copy link
Copy Markdown
Contributor

Python 3.14 changed imaplib.IMAP4.file from a plain instance attribute to a read-only property (see cpython commit introducing the change). The open() override in IMAP4WithTimeout assigned to self.file directly, which now raises:

AttributeError: property 'file' of 'IMAP4WithTimeout' object has no setter

The fix mirrors what was already done for IMAP4_TLS in commit 64250b0: remove the open() override entirely and instead pass the timeout through to the parent init, which calls open() itself using self._file internally. The _create_socket override is kept as-is so the stored self._timeout fallback still applies for any call path that omits an explicit timeout.

Fixes #638

@736-c41-2c1-e464fc974

Copy link
Copy Markdown
Contributor Author

@mjs : Is there anything that i can do to make this pull request progress?

@736-c41-2c1-e464fc974
736-c41-2c1-e464fc974 force-pushed the bugfix/3.14-compatibility-IMAP4.file-read-only branch 3 times, most recently from 3ae39f9 to 4b1918d Compare June 15, 2026 07:20
Python 3.14 changed imaplib.IMAP4.file from a plain instance attribute
to a read-only property (see cpython commit introducing the change). The
open() override in IMAP4WithTimeout assigned to self.file directly, which
now raises:

    AttributeError: property 'file' of 'IMAP4WithTimeout' object has no setter

The fix mirrors what was already done for IMAP4_TLS in commit 64250b0:
remove the open() override entirely and instead pass the timeout through
to the parent __init__, which calls open() itself using self._file
internally. The _create_socket override is kept as-is so the stored
self._timeout fallback still applies for any call path that omits an
explicit timeout.

Fixes mjs#638
@736-c41-2c1-e464fc974
736-c41-2c1-e464fc974 force-pushed the bugfix/3.14-compatibility-IMAP4.file-read-only branch from 4b1918d to ee967b8 Compare June 15, 2026 07:21
@mjs
mjs merged commit 1dbd03d into mjs:master Jun 28, 2026
9 checks passed
@mjs

mjs commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AttributeError: property 'file' of 'IMAP4WithTimeout' object has no setter (Python 3.14)

2 participants